package com.coolcode.exception;

import com.coolcode.enums.ExceptionErrorCode;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
public class ValidationException extends RuntimeException{

    private String errorCode;

    public ValidationException(String errorCode, String errorMessage) {
        super(errorMessage);
        this.errorCode = errorCode;
    }

    public ValidationException(ExceptionErrorCode errorCode, String... errorMessage) {
        super(String.format(errorCode.getDesc(), errorMessage));
        this.errorCode = errorCode.getCode();
    }
}
